﻿using System.Security.Claims;
using BilbilBLL;
using BilbilDAL;
using Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Modles.DTO;

namespace bilbil.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManageUserInfoController : ControllerBase
    {
        [HttpGet]
        public IActionResult GetUserInfos()
        {
            return new JsonResult(new ManageUserInfoServer().GetUserInfos());
        }
        [HttpDelete]
        public IActionResult DeleteUserInfos(int id)
        {
            return new JsonResult(new ManageUserInfoServer().DeleteUserInfos(id));
        }
        /// <summary>
        /// 根据前端发送的用户信息表id和用户信息修改用户信息
        /// </summary>
        /// <param name="modify_DTO"></param>
        /// <returns></returns>
        [HttpPut]
        public IActionResult UserinfoModify([FromBody] UserInfoModify_DTO modify_DTO)
        {
            ResponseTool res = new PersonalHomepageFunctionServer().UserinfoModify(modify_DTO);
            return new JsonResult(res);
        }
    }
}
